/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaclass;

import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;

/**
 *
 * @author Vincent
 */
public class RedirectProperties {
    private String protocal;
    private String port;
    private String serverName;
    private String contextPath;
    private String url;
    private ExternalContext ec;
    
    public RedirectProperties(){
        this.protocal   = "http://";
        this.port       = ":8080";
        
        this.ec  = FacesContext.getCurrentInstance().getExternalContext();
        ec.getRequestContextPath();
        
        this.serverName     = ec.getRequestServerName();
        this.contextPath    = ec.getRequestContextPath();
    }

    public String getContextPath() {
        return contextPath;
    }

    public void setContextPath(String contextPath) {
        this.contextPath = contextPath;
    }

    public String getPort() {
        return port;
    }

    public void setPort(String port) {
        this.port = port;
    }

    public String getProtocal() {
        return protocal;
    }

    public void setProtocal(String protocal) {
        this.protocal = protocal;
    }

    public String getServerName() {
        return serverName;
    }

    public void setServerName(String serverName) {
        this.serverName = serverName;
    }

    public String getUrl() {
        this.url = this.protocal + this.serverName + this.port + this.contextPath;
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }
        
}
